import https from "./https"

class Mine extends https{

	//注册
	// reqister(code){
	// 	return this.request.post('/plugin/member_login/api_index/regiest',{
	// 		type: "wechat",
	// 		appid: getApp().globalData.appid,
	// 		key: getApp().globalData.key
	// 		data: {	// 		    code	// 		}
	// 	},true)
	// }
	reqister(nickName,avatarUrl,openid){
		return this.request.post('/plugin/member_login/api_index/regiest',{
			type: "wechat",
			appid: getApp().globalData.appid,
			key: getApp().globalData.key,
			openid: openid,
			data:{
				nickName,
				avatarUrl,
			}
		},true)
	}

	// 登录
	login(code){
		return this.request.post('/plugin/member_login/api_index/login',{
			
			type: "wechat",
			appid: getApp().globalData.appid,
			key: getApp().globalData.key,
			code
			
		},false)
	}
	
	//个人资料
	getUseInfo(){
		return this.request.post('/plugin/member/api_index/userData',{
			proof: uni.getStorageSync('token')
		},false)
	}
	
	//获取店铺状态
	getStoreStatus(){
		return this.request.post('/plugin/store/api_index/apply_check',{
			proof: uni.getStorageSync('token')
		})
	}
	
	//修改头像
	changeHeadImg(portrait){
		return this.request.post('/plugin/member/api_index/changeHeadImg',{
			proof: uni.getStorageSync('token'),
			head_portrait: portrait
			
		},true)
	}
	
	//修改生日
	changeBirthday(birthday){
		return this.request.post('/plugin/member/api_index/changeBirthday',{
			birthday,
			proof: uni.getStorageSync('token')
		},true)
	}
	
	//修改昵称
	changeNickName(name){
		return this.request.post('/plugin/member/api_index/changeNickName',{
			proof: uni.getStorageSync('token'),
			nick_name: name
		},true)
	}
	
	//修改手机号
	changePhone(phone,code){
		return this.request.post('/plugin/member/api_index/changePhone',{
			proof: uni.getStorageSync('token'),
			phone,
			code
		},true)
	}
	
	//修改性别
	changeSex(name){
		return this.request.post('/plugin/member/api_index/changeSex',{
			proof: uni.getStorageSync('token'),
			sex: name
		},true)
	}
	
	//登录前发短信
	beforeSendSms(phone){
		return this.request.post('/plugin/member/api_public/sendCode',{
			phone,
			appid: getApp().globalData.appid,
			key: getApp().globalData.key
		},true)
	}
	
	// 登录前验证手机验证码
	beforeCheckCode(phone,code){
		return this.request.post('/plugin/member/api_public/checkCode',{
			phone,
			code
		},true)
	}
	
	//登录后发短信
	sendSms(phone){
		return this.request.post('/plugin/member/api_index/sendCode',{
			phone,
			proof: uni.getStorageSync('token')
		},true)
	}
	
	// 登录后验证手机验证码
	checkCode(phone,code){
		return this.request.post('/plugin/member/api_index/checkCode',{
			proof: uni.getStorageSync('token'),
			code,
			phone
		},true)
	}
	
	//账户金额
	getAmount(type){
		return this.request.post('/plugin/finance/api_index/finance_money',{
			proof: uni.getStorageSync('token'),
			finance_type: type
			
		})
	}
	
	// 流水记录
	waterRecord(type,page){
		return this.request.post('/plugin/finance/api_index/finance_list',{
			proof: uni.getStorageSync('token'),
			finance_type: type,
			page,
			page_size: 30,
			money_type: ''
			
		})
	}
	
	
	applyWithdraw(type,money){  //申请提现
		return this.request.post('/plugin/finance/api_index/apply_extract',{
			proof: uni.getStorageSync('token'),
			finance_type: type,
			money,
		},true)
	}
	
	
	applyCharge(type,money){    //充值
		return this.request.post('/plugin/finance/api_index/recharge',{
			proof: uni.getStorageSync('token'),
			finance_type: type,
			pay_type: 'wechatpay',
			money
			
		},true)
	}
	
	// 邀请用户
	invitedUsers(){
		return this.request.post('/plugin/member/api_index/useryao',{
			proof: uni.getStorageSync('token')
		})
	}
	
	//我的团队
	myTeam(){
		return this.request.post('/plugin/member/api_index/mygroup',{
			proof: uni.getStorageSync('token')
		})
	}
	
	//邀请商家
	inviteBussiness(){
		return this.request.psot('/plugin/member/api_index/soteyao',{
			proof: uni.getStorageSync('token')
		})
	}
	
}
export default Mine